import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtModule, JwtService } from '@nestjs/jwt';
import { Goods } from '../grocery/entities/goods.entity';
import { UserController } from './controller/user.controller';
import { User } from './entities/user.entity';
import { UserService } from './service/user.service';
import { AuthService } from 'src/auth/auth.service';
import { AccountService } from '../grocery/service/account.service';
import { Account } from '../grocery/entities/account.entity';
import { PassportModule } from '@nestjs/passport';
import { jwtConstants } from 'src/utils/constant';
import { LocalCustomStrategy } from 'src/auth/local-custom.strategy';
import { JwtStrategy } from 'src/auth/jwt.strategy';
import { CateController } from './controller/cate.controller';
import { CateService } from './service/cate.service';
import { CategoryService } from '../grocery/service/category.service';
import { Category } from '../grocery/entities/category.entity';
import { PromotService } from './service/promot.service';
import { PromotionService } from '../grocery/service/promotion.service';
import { Promotion } from '../grocery/entities/promotion.entity';
import { PromotController } from './controller/promot.controller';
import { GoodsService } from '../grocery/service/goods.service';
import { HotService } from './service/hot.service';
import { HotController } from './controller/hot.controller';
import { NewService } from '../grocery/service/new.service';
import { New } from '../grocery/entities/new.entity';
import { ProductController } from './controller/product.controller';
import { ProductService } from './service/product.service';
import { FavController } from './controller/fav.controller';
import { FavService } from './service/fav.service';
import { FavEntity } from './entities/fav.entity';

@Module({
  imports: [
    TypeOrmModule.forFeature([Account, Category, Promotion, New, Goods, User, FavEntity], 'shop'),

    PassportModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: '36000s' },
    }),
  ],
  controllers: [
    UserController,
    CateController,
    PromotController,
    HotController,
    ProductController,
    FavController
  ],
  providers: [
    AuthService,
    AccountService,
    LocalCustomStrategy,
    JwtStrategy,

    UserService,

    CategoryService,
    CateService,

    PromotionService,
    PromotService,
    GoodsService,

    NewService,
    HotService,
    ProductService,

    FavService
  ],
  exports: [UserService],
})
export class CustomModule {}
